<!DOCTYPE html>
<html>

{include file='public/header'}
<style>
    .layui-card {
        border: 1px solid #ececec;
    }
</style>

<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a href="javascript:void(0)">首页</a>
            <a href="javascript:void(0)">短剧推广</a>
            <a><cite>智能推送</cite></a>
        </span>
        <a class="layui-btn layui-btn-small" id="reload" title="刷新">
            <i class="layui-icon" style="line-height:30px"><i class="iconfont">&#xe6aa;</i></i>
        </a>
    </div>
    <div class="x-body">
        <form class="layui-form" action="">
            <div class="layui-row layui-col-space15" style="margin-bottom:10px">
                <div class="layui-col-md3">
                    <div class="layui-card">
                        <div class="layui-card-header flex">
                            <div style="display: flex;align-items: center;">
                                <b style="margin-right: 5px;">继续观看提醒</b>
                                <input type="checkbox" name="watch_reminder" lay-filter="watch_reminder"
                                    lay-skin="switch" lay-text="ON|OFF" {eq name="$data.watch_reminder" value="1"
                                    }checked{/eq}>
                            </div>
                        </div>
                        <div class="layui-card-body">
                            开启后系统将向当日观看过短剧，并且未观看时间超过7小时的用户提示继续观看提醒。
                            <div class="layui-font-blue">推送时间：每天10：30</div>
                        </div>
                    </div>
                </div>
                <div class="layui-col-md3">
                    <div class="layui-card">
                        <div class="layui-card-header flex">
                            <div style="display: flex;align-items: center;">
                                <b style="margin-right: 5px;">未签到提醒</b>
                                <input type="checkbox" name="sign_reminder" lay-filter="sign_reminder" lay-skin="switch"
                                    lay-text="ON|OFF" {eq name="$data.sign_reminder" value="1" }checked{/eq}>
                            </div>
                        </div>
                        <div class="layui-card-body">
                            开启后系统将向未签到用户推送相应的客服消息，推送时间：用户签到后的24小时后，最多推送两次。
                            <div class="layui-font-blue">推送时间：每天20：00</div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <script>
        layui.use('form', function () {
            var form = layui.form;
            let params = {
                watch_reminder: {$data.watch_reminder},
                sign_reminder: {$data.sign_reminder}
            }
            form.on('switch(watch_reminder)', function (data) {
                params.watch_reminder = data.elem.checked ? 1 : 0;
                setting()
            });
            form.on('switch(sign_reminder)', function (data) {
                params.sign_reminder = data.elem.checked ? 1 : 0;
                setting()
            });
            function setting() {
                Ajax('/cps/video/setting', params).then(data => {
                    if (data.code === 200) {
                        layer.msg(data.message, {
                            icon: 6
                        });
                    } else {
                        layer.alert(data.message);
                    }
                });
            }
        });
    </script>
</body>

</html>